<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
<title>Insert title here</title>
<script src="${pageContext.request.contextPath}/js/commonSearch.js" type="text/javascript"></script>
</head>
<body>


<form name="frmEditOrDelete" action="${pageContext.request.contextPath}/stu">
	<input type="hidden" name="id">
	<input type="hidden" name="flag">
</form>
			<table class="table">
				<tr>
					<th colspan="7">学生信息查询</th>
				</tr>
				<tr>
					<form name="frmSearch" action="${pageContext.request.contextPath}/stu">
					<th colspan="5">
						<input type="hidden" name="pageNo" value="${page.pageNo }">
						<input type="hidden" name="flag" value="search">
						<input type="text" name="nameForSearch" class="form-control" value="${param.nameForSearch }" placeholder="请输入要查询的学生姓名" >
					</th>
					<th>
						<input type="button" onclick="doSearchBtn()" class="btn btn-secondary" value="查询">
					</th>
					</form>
					<th>
						<input type="button" class="btn btn-secondary" value="添加学生" onclick="goAdd('${pageContext.request.contextPath}/student')">
					</th>
				</tr>
				<tr>
					<th colspan="7">${msg }</th>
				</tr>
				
		<c:if test="${ not empty page }">
			<c:if test="${page.totalCount == 0 }">
				<tr>
					<th colspan="7">查询无结果</th>
				</tr>
			</c:if>
			<c:if test="${page.totalCount != 0}">
			
				<tr>
					<td>序号</td>
					<td>姓名</td>
					<td>性别</td>
					<td>出生日期</td>
					<td>爱好</td>
					<td>在读院校</td>
					<td>操作</td>
				</tr>
			
					<c:forEach var="stu" items="${ page.records}">
					
					
						<tr>
							<td>${stu.id}</td>
							<td>${stu.userName}</td>
							<td>${stu.genderStr}</td>
							<td>${stu.birthdayYMDStr}</td>
							<td>${stu.hobbiesStr}</td>
							<td>${stu.shoolStr}</td>
							<td>
								<input type="button" class="btn btn-info" value="修改" onclick="goEdit('${stu.id}')" >
								&nbsp;
								<input type="button" class="btn btn-warning" value="删除" onclick="goDelete('学生','${stu.id}')">
							</td>
						</tr>
					</c:forEach>
					<tr>
						<td colspan="7">
							<div class="container mt-3">
							  <ul class="pagination justify-content-center">
							  <li class="page-item"><a class="page-link" href="javascript:goSearch(1);">首页</a></li>
							    <li class="page-item"><a class="page-link" href="javascript:goPre();">上一页</a></li>
							    <li class="page-item"><a class="page-link" href="javascript:void(0);">当前第[${ page.pageNo}]页，共[${page.pageMax }]页，共[${page.totalCount }]条记录</a></li>
							    
							    <li class="page-item"><a class="page-link" href="javascript:goNext(${page.pageMax });">下一页</a></li>
							    <li class="page-item"><a class="page-link" href="javascript:goSearch(${page.pageMax });">尾页</a></li>
							  </ul>
							</div>
						</td>
					</tr>
					</c:if>
					</c:if>
			</table>
			
			
		
</body>
</html>